package cn.edu.nit.sys.mapper;

import cn.edu.nit.sys.entity.Teacher;
import cn.edu.nit.sys.vo.TeacherVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author xiaobai
 * @Date 2022/10/1 14:16
 * @Version 1.0.0
 */
@Mapper
public interface TeacherMapper extends BaseMapper<Teacher> {

    Page<Teacher> getList(Page<Teacher> page, @Param("teacher") TeacherVO teacherVO);

    @Select("select name from sys_position where name = #{position}")
    String findPos(String position);

    @Insert("insert into sys_position(name) values(#{position})")
    int addPos(String position);

    @Select("select id from sys_teacher order by create_time desc limit 1")
    Long findLastOneId();
}
